static public void Push(Screen screen)
{
+ if (Screens.Count > 0)
+ {
+ Screens.Peek().Active = false;
+ }
+
+ screen.LoadContent();
+ screen.Active = true;
Screens.Push(screen);
}
static public void Pop()
{
- Screens.Pop();
+ var screen = Screens.Pop();
+ screen.Active = false;
+ screen.CleanUp();
+ Screens.Peek().Active = true;
}
static public void Update(GameTime gameTime)
static public void Draw(SpriteBatch spriteBatch)
{
- foreach (Screen screen in Screens)
- {
- screen.Draw(spriteBatch);
- }
+ Screens.Peek().Draw(spriteBatch);
}
internal static void SetGame(SuperPolarity game)